package com.controller.backend;

import com.biz.CustomerCommissionLogBiz;
import com.core.Result;
import com.core.ResultGenerator;
import com.entity.model.CustomerCommissionLog;
import com.github.pagehelper.PageInfo;
import com.util.webpage.PageData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import tk.mybatis.mapper.entity.Condition;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* Created by jc on 2020/03/16.
*/
@Controller
@RequestMapping("/backend/security/customerCommissionLog")
public class CustomerCommissionLogController extends BaseController<CustomerCommissionLog>{
    @Autowired
    private CustomerCommissionLogBiz customerCommissionLogBiz;

    @RequestMapping(value = "commissionLogList")
    @ResponseBody
    public Result commissionLogList(Integer commissionId) {
        Condition condition=new Condition(CustomerCommissionLog.class);
        condition.createCriteria().andEqualTo("customerCommissionId",commissionId);
        List<CustomerCommissionLog> customerCommissionLogs = customerCommissionLogBiz.findByCondition(condition);
        PageInfo<CustomerCommissionLog> pageInfo = new PageInfo<CustomerCommissionLog>(customerCommissionLogs);
        Integer total = (int) pageInfo.getTotal();
        return ResultGenerator.genSuccessResult(customerCommissionLogs,total);
    }
}
